package com.kakavr.emp.service;

import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.kakavr.base.service.BaseService;
import com.kakavr.emp.dao.IEmployeeDao;
import com.kakavr.page.Pagination;
import com.kakavr.page.constant.PaginationConstant;

@Service
public class EmployeeService extends BaseService implements IEmployeeService {
	@Resource
	private IEmployeeDao employeeDao;

	@Override
	public Map<String, Object> selectEmpInfo(Map<String, Object> map) {
		return employeeDao.selectEmpInfo(map);
	}

	@Override
	public Pagination<Map<String, Object>> selectEmpByPage(
			Map<String, Object> map) {
		PageHelper.startPage(NumberUtils.toInt((String) map
				.get(PaginationConstant.PAGE_NO_NAME)), NumberUtils
				.toInt((String) map.get(PaginationConstant.PAGE_SIZE_NAME)));
		return new Pagination<Map<String, Object>>(
				employeeDao.selectEmpList(map));
	}

	@Override
	public void deleteEmp(Map<String, Object> map) {
		employeeDao.deleteEmp(map);
	}

}
